home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3DWinViewer.h < prev    next >
C/C++ Source or Header  |  1996-08-21  |  14KB  |  427 lines

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3DWinViewer.h                                             **                        
  4.  **                                                                              **
  5.  **     Purpose:     WinViewer Controller Interface File.                     **            
  6.  **                                                                              **
  7.  **     Copyright (C) 1996 Apple Computer, Inc.  All rights reserved.         **
  8.  **                                                                              **
  9.  *****************************************************************************/
  10.  
  11. #ifndef QD3DWinViewer_h
  12. #define QD3DWinViewer_h
  13.  
  14. #include "QD3D.h"
  15. #include "QD3DGroup.h"
  16.  
  17. #if defined(OS_WIN32) && OS_WIN32
  18.  
  19. #include <windows.h>
  20.  
  21. #if defined(_MSC_VER)    /* Microsoft Visual C */
  22.     #if defined(Q3VIEWER_EXPORTING)    // define when building DLL
  23.         #define Q3VIEWER_EXPORT __declspec( dllexport )     
  24.         #define Q3VIEWER_API      
  25.     #else
  26.         #define Q3VIEWER_EXPORT __declspec( dllimport )    
  27.         #define Q3VIEWER_API __cdecl     
  28.     #endif //WIN32_EXPORTING
  29. #else
  30.     #define Q3VIEWER_EXPORT
  31.     #define Q3VIEWER_API      
  32. #endif  /*  _MSC_VER  */
  33.  
  34. typedef void *TQ3ViewerObject;
  35.  
  36. typedef TQ3Status (Q3VIEWER_API *TQ3WinViewerDrawingCallbackMethod)(
  37.         TQ3ViewerObject    theViewer,
  38.         const void *data);
  39.  
  40. enum {
  41.     kQ3ViewerShowBadge             = 1<<0,
  42.     kQ3ViewerActive                = 1<<1,
  43.     kQ3ViewerControllerVisible    = 1<<2,
  44.     kQ3ViewerDrawFrame            = 1<<3,
  45.     kQ3ViewerDraggingOff        = 1<<4,
  46.     
  47.     kQ3ViewerButtonCamera        = 1<<5,
  48.     kQ3ViewerButtonTruck        = 1<<6,
  49.     kQ3ViewerButtonOrbit        = 1<<7,
  50.     kQ3ViewerButtonZoom            = 1<<8,
  51.     kQ3ViewerButtonDolly        = 1<<9,
  52.     kQ3ViewerButtonReset        = 1<<10,
  53.     
  54.     kQ3ViewerOutputTextMode        = 1<<11,
  55.     kQ3ViewerDragMode            = 1<<12,
  56.  
  57.     kQ3ViewerDrawGrowBox        = 1<<13,
  58.     kQ3ViewerDrawDragBorder        = 1<<14,
  59.  
  60.     kQ3ViewerDraggingInOff        = 1<<15,
  61.     kQ3ViewerDraggingOutOff        = 1<<16,
  62.  
  63.     kQ3ViewerDefault            = 1<<31
  64. };
  65.  
  66.  
  67. enum {
  68.     kQ3ViewerEmpty    = 0,
  69.     kQ3ViewerHasModel = 1<<0,
  70.     kQ3ViewerHasUndo  = 1<<1
  71. };
  72.  
  73. typedef enum TQ3ViewerCameraView {
  74.     kQ3ViewerCameraRestore,
  75.     kQ3ViewerCameraFit,
  76.     kQ3ViewerCameraFront,
  77.     kQ3ViewerCameraBack,
  78.     kQ3ViewerCameraLeft,
  79.     kQ3ViewerCameraRight,
  80.     kQ3ViewerCameraTop,
  81.     kQ3ViewerCameraBottom
  82. } TQ3ViewerCameraView;
  83.  
  84. #ifdef __cplusplus
  85. extern "C" {
  86. #endif    /* __cplusplus */
  87.  
  88. /*Q3VIEWER_EXPORT ATOM Q3WinInitializeViewerWindowClass (HANDLE hInstance);*/
  89.  
  90. /******************************************************************************
  91.  **                                                                             **
  92.  **        Win32 Window Class Name                                               **
  93.  **        Can be passed as a parameter to CreateWindow or CreateWindowEx       **
  94.  **                                                                             **
  95.  *****************************************************************************/
  96.  
  97. #define kQ3ViewerClassName "QD3DViewerWindow"
  98.  
  99. /******************************************************************************
  100.  **                                                                             **
  101.  **        Creation and destruction                                             **
  102.  **        Note that this is not a QuickDraw 3D object                             **
  103.  **                                                                             **
  104.  *****************************************************************************/
  105.  
  106. Q3VIEWER_EXPORT TQ3ViewerObject Q3VIEWER_API Q3WinViewerNew (
  107.     HWND window, 
  108.     const RECT *rect, 
  109.     unsigned long flags);
  110.  
  111. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerDispose(
  112.     TQ3ViewerObject    theWinViewer);
  113.  
  114. /******************************************************************************
  115.  **                                                                             **
  116.  **        Functions to attach data to a WinViewer                                 **
  117.  **                                                                             **
  118.  *****************************************************************************/
  119. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerUseFile(
  120.     TQ3ViewerObject    theWinViewer,
  121.     HANDLE                fileHandle);
  122.  
  123. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerUseUnixPath (
  124.     TQ3ViewerObject    theWinViewer,
  125.     char *filePath); /* temporary until we have a win storage */
  126.  
  127. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerUseData(
  128.     TQ3ViewerObject    theWinViewer,
  129.     void                *data,
  130.     unsigned long        size);
  131.  
  132. /******************************************************************************
  133.  **                                                                             **
  134.  **        Functions to write data out from the WinViewer                         **
  135.  **                                                                             **
  136.  *****************************************************************************/
  137.  
  138. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerWriteUnixPath (
  139.     TQ3ViewerObject    theWinViewer,
  140.     char                *filePath);
  141.  
  142. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerWriteFile(
  143.     TQ3ViewerObject    theWinViewer,
  144.     HANDLE                fileHandle);
  145.  
  146. Q3VIEWER_EXPORT unsigned long Q3VIEWER_API Q3WinViewerWriteData(
  147.     TQ3ViewerObject    theWinViewer,
  148.     void                **data);
  149.  
  150. /******************************************************************************
  151.  **                                                                             **
  152.  **        Use this function to force the WinViewer to re-draw                     **
  153.  **                                                                             **
  154.  *****************************************************************************/
  155.  
  156. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerDraw(
  157.     TQ3ViewerObject    theWinViewer);
  158.  
  159. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerDrawContent(
  160.     TQ3ViewerObject theViewer);
  161.  
  162. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerDrawControlStrip(
  163.     TQ3ViewerObject theViewer);
  164.  
  165.  
  166. /******************************************************************************
  167.  **                                                                             **
  168.  **        Function used by the WinViewer to filter and handle events             **
  169.  **                                                                             **
  170.  *****************************************************************************/
  171.  
  172. Q3VIEWER_EXPORT BOOL Q3VIEWER_API Q3WinViewerMouseDown(
  173.     TQ3ViewerObject    theWinViewer,
  174.     long                x,
  175.     long                y);
  176.  
  177. Q3VIEWER_EXPORT BOOL Q3VIEWER_API Q3WinViewerContinueTracking(
  178.     TQ3ViewerObject    theWinViewer,
  179.     long                x,
  180.     long                y);
  181.  
  182. Q3VIEWER_EXPORT BOOL Q3VIEWER_API Q3WinViewerMouseUp(
  183.     TQ3ViewerObject    theWinViewer,
  184.     long                x,
  185.     long                y);
  186.  
  187. /* TBD: Re-parameterize using params from WM_CHAR and WM_KEYDOWN, WM_KEYUP
  188.  
  189. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerKeyDown(
  190.     TQ3ViewerObject    theWinViewer,
  191.     unsigned char        keyCode,
  192.     unsigned short        characterCode,
  193.     unsigned short        flags);
  194.  
  195. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerKeyUp(
  196.     TQ3ViewerObject    theWinViewer,
  197.     unsigned char        keyCode,
  198.     unsigned short        characterCode,
  199.     unsigned short        flags);
  200. */
  201.  
  202.  
  203. /******************************************************************************
  204.  **                                                                             **
  205.  **        This function returns a Bitmap of the contents of the                  **
  206.  **        WinViewer's window.  The application should dispose the Bitmap.         **
  207.  **                                                                             **
  208.  *****************************************************************************/
  209.  
  210. Q3VIEWER_EXPORT HBITMAP Q3VIEWER_API Q3WinViewerGetBitmap(
  211.     TQ3ViewerObject    theWinViewer);
  212.  
  213. /******************************************************************************
  214.  **                                                                             **
  215.  **        Calls for dealing with Buttons                                         **
  216.  **                                                                             **
  217.  *****************************************************************************/
  218.  
  219. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetButtonRect(
  220.     TQ3ViewerObject    theWinViewer,
  221.     unsigned long        button,
  222.     RECT                *rectangle);
  223.  
  224. Q3VIEWER_EXPORT unsigned long Q3VIEWER_API Q3WinViewerGetCurrentButton(
  225.     TQ3ViewerObject    theWinViewer);
  226.     
  227. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetCurrentButton(
  228.     TQ3ViewerObject    theWinViewer,
  229.     unsigned long        button);
  230.  
  231. /******************************************************************************
  232.  **                                                                             **
  233.  **        Functions to set/get the group to be displayed by the WinViewer.     **
  234.  **                                                                             **
  235.  *****************************************************************************/
  236.  
  237. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerUseGroup(
  238.     TQ3ViewerObject    theWinViewer,
  239.     TQ3GroupObject        group);
  240.     
  241. Q3VIEWER_EXPORT TQ3GroupObject Q3VIEWER_API Q3WinViewerGetGroup(
  242.     TQ3ViewerObject    theWinViewer);
  243.  
  244. /******************************************************************************
  245.  **                                                                             **
  246.  **        Functions to set/get the color used to clear the window                 **
  247.  **                                                                             **
  248.  *****************************************************************************/
  249.  
  250. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetBackgroundColor(
  251.     TQ3ViewerObject    theWinViewer,
  252.     TQ3ColorARGB        *color);
  253.     
  254. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetBackgroundColor(
  255.     TQ3ViewerObject    theWinViewer,
  256.     TQ3ColorARGB        *color);
  257.  
  258. /******************************************************************************
  259.  **                                                                             **
  260.  **        Getting/Setting a WinViewer's View object.  Disposal is needed.         **
  261.  **                                                                             **
  262.  *****************************************************************************/
  263.  
  264. Q3VIEWER_EXPORT TQ3ViewObject Q3VIEWER_API Q3WinViewerGetView(
  265.     TQ3ViewerObject    theWinViewer);
  266.  
  267. Q3VIEWER_EXPORT TQ3Status Q3WinViewerRestoreView(
  268.     TQ3ViewerObject    theWinViewer);
  269.  
  270. /******************************************************************************
  271.  **                                                                             **
  272.  **        Calls for setting/getting WinViewer flags                             **
  273.  **                                                                             **
  274.  *****************************************************************************/
  275.  
  276. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetFlags(
  277.     TQ3ViewerObject    theWinViewer,
  278.     unsigned long        flags);
  279.  
  280. Q3VIEWER_EXPORT unsigned long Q3VIEWER_API Q3WinViewerGetFlags(
  281.     TQ3ViewerObject    theWinViewer);
  282.  
  283. /******************************************************************************
  284.  **                                                                             **
  285.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  286.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  287.  **        or the current dimensions of the window (if you do a Set).             **
  288.  **                                                                             **
  289.  *****************************************************************************/
  290.  
  291. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetBounds(
  292.     TQ3ViewerObject    theWinViewer,
  293.     RECT                *bounds);
  294.     
  295. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetBounds(
  296.     TQ3ViewerObject    theWinViewer,
  297.     RECT                *bounds);
  298.  
  299. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetDimension(
  300.     TQ3ViewerObject    theViewer,
  301.     unsigned long    width,
  302.     unsigned long    height);
  303.  
  304. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetDimension(
  305.     TQ3ViewerObject    theWinViewer,
  306.     unsigned long        *width,
  307.     unsigned long        *height);
  308.  
  309. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetMininumDimension(
  310.     TQ3ViewerObject    theViewer,
  311.     unsigned long    *width,
  312.     unsigned long    *height);
  313.  
  314. /******************************************************************************
  315.  **                                                                             **
  316.  **        Window related calls                                                 **
  317.  **                                                                             **
  318.  *****************************************************************************/
  319.  
  320. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetWindow(
  321.     TQ3ViewerObject    theWinViewer,
  322.     HWND                aWindow);
  323.     
  324. Q3VIEWER_EXPORT HWND Q3VIEWER_API Q3WinViewerGetWindow(
  325.     TQ3ViewerObject    theWinViewer);
  326.  
  327. Q3VIEWER_EXPORT TQ3ViewerObject Q3VIEWER_API Q3WinViewerGetViewer(
  328.     HWND                theWindow);
  329.  
  330.  
  331. /******************************************************************************
  332.  **                                                                             **
  333.  **        Adjust Cursor should be called from idle loop to allow the WinViewer **
  334.  **        to change the cursor according to the cursor position/object under     **
  335.  **        the cursor.                                                             **
  336.  **                                                                             **
  337.  *****************************************************************************/
  338.  
  339. Q3VIEWER_EXPORT TQ3Boolean Q3VIEWER_API Q3WinViewerAdjustCursor(
  340.     TQ3ViewerObject    theWinViewer,
  341.     long                x,
  342.     long                y);
  343.  
  344. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerCursorChanged(
  345.     TQ3ViewerObject    theViewer);
  346.  
  347. /******************************************************************************
  348.  **                                                                             **
  349.  **        Returns the state of the WinViewer.  See the constant defined at the **
  350.  **        top of this file.                                                     **
  351.  **                                                                             **
  352.  *****************************************************************************/
  353.  
  354. Q3VIEWER_EXPORT unsigned long Q3VIEWER_API Q3WinViewerGetState(
  355.     TQ3ViewerObject    theWinViewer);
  356.  
  357. /******************************************************************************
  358.  **                                                                             **
  359.  **        Clipboard utilities                                                     **
  360.  **                                                                             **
  361.  *****************************************************************************/
  362.  
  363. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerClear(
  364.     TQ3ViewerObject    theWinViewer);
  365.     
  366. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerCut(
  367.     TQ3ViewerObject    theWinViewer);
  368.     
  369. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerCopy(
  370.     TQ3ViewerObject    theWinViewer);
  371.     
  372. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerPaste(
  373.     TQ3ViewerObject    theWinViewer);
  374.  
  375. /******************************************************************************
  376.  **                                                                             **
  377.  **        Drawing CallBack                                                     **
  378.  **                                                                             **
  379.  *****************************************************************************/
  380.  
  381. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetDrawingCallbackMethod(
  382.         TQ3ViewerObject                    theViewer,
  383.         TQ3WinViewerDrawingCallbackMethod    callbackMethod,
  384.         const void *data);
  385.  
  386. /******************************************************************************
  387.  **                                                                             **
  388.  **        Undo                                                                  **
  389.  **                                                                             **
  390.  *****************************************************************************/
  391.  
  392. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerUndo(
  393.             TQ3ViewerObject    theViewer);
  394.         
  395. TQ3Boolean Q3VIEWER_API Q3WinViewerGetUndoString(
  396.             TQ3ViewerObject    theViewer, 
  397.             char             *string,
  398.             unsigned long     *cnt);
  399.  
  400. /******************************************************************************
  401.  **                                                                             **
  402.  **        New Camera Stuff                                                     **
  403.  **                                                                             **
  404.  *****************************************************************************/
  405.  
  406.  
  407. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerGetCameraCount(
  408.         TQ3ViewerObject    theViewer, 
  409.         unsigned long     *cnt);
  410.  
  411. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetCameraNumber(
  412.         TQ3ViewerObject    theViewer, 
  413.         unsigned long     cameraNo);
  414.  
  415. Q3VIEWER_EXPORT TQ3Status Q3VIEWER_API Q3WinViewerSetCameraView(
  416.         TQ3ViewerObject        theViewer, 
  417.         TQ3ViewerCameraView viewType);
  418.  
  419. #ifdef __cplusplus
  420. }
  421. #endif    /* __cplusplus */
  422.  
  423. #endif     /* OS_WINDOWS */
  424.  
  425. #endif    /* QD3DWinViewer_h */
  426.  
  427.